<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$id=$_RQ['id'];
	if(!$id){
		exi('请选择兑换券','error');
	}	
	$coupon=pdo_get('jy_sendgoods_order',array('uniacid'=>$_SESSION['uniacid'],'id'=>$id));
	$coupon['goods']=pdo_get('jy_weishop_goods',array('id'=>$coupon['goodsid']));
	$coupon['option_title']=pdo_getcolumn('jy_weishop_goods_option',array('id'=>$coupon['optionid']),'title');
	$return['coupon']=$coupon;
	$member=pdo_get('core_members',array('uniacid'=>$_SESSION['uniacid'],'id'=>$_SESSION['uid']));
	$log=pdo_get('jy_sendgoods_ex_log',array('order_id'=>$id,'smid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	if($log){
		$return['isget']=1;
	}else{
		$return['isget']=2;
	}
	$return['sharedata']=array(
		'title'=>$coupon['goods']['title'].'兑换券',
		'desc'=>'您的好友'.$member['nickname'].'送您一张兑换券',
		'link'=>custom_url('jy_sendgoods/scoupon_detail/main/id='.$id,true),
		'imgUrl'=>ATTACHMENT_URL.$coupon['goods']['image'],
	);
	exi($return);
}
?>